/**  
 * All rights Reserved, Designed By <a href="www.itttq.com" target="_blank">www.itttq.com</a>
 * @date:   2017-07-21 11:42:21
 * @Copyright: 2017 <a href="www.itttq.com" target="_blank">www.itttq.com</a> Inc. All rights reserved. 
 */
package com.itttq.gshop.pbpm.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.itttq.gshop.domain.po.SmsCategoryPo;
import com.itttq.gshop.domain.to.ResultPageTo;
import com.itttq.gshop.pbpm.mapper.ISmsCategoryMapper;

@Service
public class SmsCategoryService {
	@Autowired
	private ISmsCategoryMapper smsCategoryMapper;
	
	/**
	 * 根据ID获取SmsCategoryPo对象
	 * 
	 * @param id
	 * @return
	 * @Author 迷蝶
	 * @return SmsCategoryPo
	 */
	public SmsCategoryPo getSmsCategory(int id) {
		return smsCategoryMapper.findSmsCategoryById(id);
	}
	
	/**
	 * 根据条件获取SmsCategoryPo对象，并返回查询的数据总数
	 * 
	 * @param smsCategory
	 * @Author 迷蝶
	 * @return ResultPageTo<SmsCategoryPo>
	 */
	public ResultPageTo<SmsCategoryPo> getSmsCategorys(SmsCategoryPo smsCategory) {
		return new ResultPageTo<SmsCategoryPo>(smsCategory.getStart(), smsCategory.getSize(), 
				smsCategoryMapper.findSmsCategoryCount(smsCategory), smsCategoryMapper.findSmsCategorys(smsCategory));
	}
	
	/**
	 * 根据ID删除SmsCategoryPo对象
	 * 
	 * @param id
	 * @Author 迷蝶
	 */
	public Integer delSmsCategory(int id) {
		return smsCategoryMapper.delSmsCategoryById(id);
	}
	
	/**
	 * 增加SmsCategoryPo对象
	 * 
	 * @param smsCategory
	 * @Author 迷蝶
	 */
	public Integer addSmsCategory(SmsCategoryPo smsCategory) {
		return smsCategoryMapper.addSmsCategory(smsCategory);
	}
	
	/**
	 * 根据条件更新SmsCategoryPo对象
	 * 
	 * @param smsCategory
	 * @Author 迷蝶
	 */
	public Integer updateSmsCategory(SmsCategoryPo smsCategory) {
		return smsCategoryMapper.updateSmsCategory(smsCategory);
	}
	
}
